<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<table border="1">
    <caption>用户列表</caption>

    <tr> <th>用户名</th> <th>密码</th>  </tr>

</table>

<script>
    let arr = [{username:1,password:123},
                {username: 2,password:122}]
    let table = document.querySelector("table")

    for (let a of arr) {
        let tr = document.createElement("tr")
        let un = document.createElement("td")
        let pw = document.createElement("td")

        un.innerText = a.username
        pw.innerText = a.password
        tr.append(un, pw)
        table.append(tr)
    }







</script>

</body>
</html>